<!--
 * @Author: wangshuguang
 * @Date: 2022-01-05 14:35:40
 * @LastEditTime: 2022-03-31 15:41:16
 * @LastEditors: wangshuguang
 * @Description: 气泡弹框组件  默认占位符为【？】
-->

<script>
import TextToHtml from '../TextToHtml'
export default {
  components: { TextToHtml },
  props: {
    // 普通文字字符串
    lableText: {},
    // 弹框宽度  默认300px
    popoverWidth: {
      default: '300'
    }
  },
  render() {
    const { lableText, $slots, popoverWidth } = this
    // 默认插槽解析
    const content = $slots.default && $slots.default.length ? $slots.default : ''

    return <div class='popoverLabel'>
      <el-popover
        ref='popover'
        width={popoverWidth}
        trigger='hover'>
        { content || <TextToHtml text={lableText} /> }
      </el-popover>
      <i class='el-icon-question' v-popover:popover></i>
    </div>
  }
}
</script>
<style scoped lang='scss'>
.popoverLabel{
  display: inline-block;
}
</style>
